<%= javascript_include_tag "ckeditor/ckeditor.js" %>
<script type="text/javascript">
  window.onload = function(){
    CKEDITOR.replace( 'new_reply[content]' );
  }
</script>

<h1><%= @topic.title %> </h1>

<h2>Replies</h2>
<table style="width:768px;">
    <tr>
      <th>User</th>
      <th>Title</th>
    </tr>
<% @replays.each do |r| %>
    <tr>
      <td>
        <%= r.user.email if r.user %>
      </td>
      <td>
        <%= r.content %>
      </td>
    </tr>
<% end %>
</table>

<% if current_user %>
<%= form_for @new_reply, :url => {:action => :post, :mode => "reply"} do |f| %>
    <%= f.hidden_field :topic_id %>
    <%= f.hidden_field :user_id %>
    <%= f.text_area :content %>
    <%= f.submit  %>
<% end %>
<% end %>